<?php if ($wp_query->max_num_pages > 1) : ?>

	<div id="nav-above" class="navigation">
		<div class="nav-previous"><?php next_posts_link('&laquo; Older posts'); ?></div>
		<div class="nav-next"><?php previous_posts_link('Newer posts &raquo;'); ?></div>
	</div>

<?php endif; ?>

<?php $count = 0; ?>
<?php if (have_posts()) : ?>

	<?php while (have_posts()) : the_post(); $count++; ?>

		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<?php if (is_page()) : ?>

			<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
			<div class="entry-content"><?php the_content(); ?></div>
			<div class="page-links"><?php wp_link_pages(); ?></div>
			<?php edit_post_link('Edit', '<p>', '</p>'); ?>

		<?php else : ?>

			<?php if (is_single()) : ?>
				<div id="nav-above" class="navigation">
					<div class="nav-previous"><?php previous_post_link('&laquo; %link'); ?></div>
					<div class="nav-next"><?php next_post_link('%link &raquo;'); ?></div>
				</div>
			<?php endif; ?>

			<?php echo ($count > 1 || is_author() || is_category() || is_search() || is_tag() || is_archive()) ? '<h2 class="entry-title">' : '<h1 class="entry-title">'; ?>
				<?php $title = the_title('', '', false); ?>
				<?php if (empty($title)) : ?>
					<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to (no title)">(no title)</a>
				<?php elseif (is_single()) : ?>
					<?php the_title(); ?>
				<?php else : ?>
					<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
				<?php endif; ?>
			<?php echo ($count > 1 || is_author() || is_category() || is_search() || is_tag() || is_archive()) ? '</h2>' : '</h1>'; ?>

			<p class="entry-meta">Posted on <?php the_time(get_option('date_format')) ?> by <?php the_author_posts_link(); ?></p>

			<?php if (has_post_thumbnail()) the_post_thumbnail('thumbnail', array('class'=>'alignleft')); ?>

			<?php if ( ($count > 1 && !is_home()) || is_author() || is_category() || is_search() || is_tag() || is_archive() ) : ?>
				<div class="entry-summary"><?php the_excerpt(); ?></div>
			<?php else : ?>
				<div class="entry-content"><?php the_content('Continue reading &raquo;'); ?></div>
			<?php endif; ?>

			<p class="entry-tags">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?><?php the_tags('<br />Tagged: '); ?></p>

			<div class="page-links"><?php wp_link_pages(); ?></div>

			<?php if (is_single()) : ?>
				<div id="nav-below" class="navigation">
					<div class="nav-previous"><?php previous_post_link('&laquo; %link'); ?></div>
					<div class="nav-next"><?php next_post_link('%link &raquo;'); ?></div>
				</div>
			<?php endif; ?>

		<?php endif; ?>
		</div>

	<?php endwhile; ?>

	<?php if ( is_single() || (is_page() && (comments_open() || pings_open()))) comments_template('', true); ?>

<?php endif; ?>

<?php if ($wp_query->max_num_pages > 1) : ?>

	<div id="nav-below" class="navigation">
		<div class="nav-previous"><?php next_posts_link('&laquo; Older posts'); ?></div>
		<div class="nav-next"><?php previous_posts_link('Newer posts &raquo;'); ?></div>
	</div>

<?php endif; ?>